//
//  NeedPurchaseViewModel.m
//  GLGW_Shoping
//
//  Created by yang on 2018/11/12.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "NeedPurchaseViewModel.h"
#import "NeedPurTableViewCell.h"

@interface NeedPurchaseViewModel ()<UITableViewDelegate,UITableViewDataSource>

@end

@implementation NeedPurchaseViewModel
-(instancetype)initWithViewToViewModel:(UITableView *)tableView theSuperView:(UIView *)superView{
    if (self = [super init]) {
        superView.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        tableView.y = tableView.y+kHeightProportion_In_iPhoneTriploid(10);
        tableView.height = tableView.height - kHeightProportion_In_iPhoneTriploid(10);
        tableView.backgroundColor = [UIColor whiteColor];
        tableView.dataSource = self;
        tableView.delegate = self;
        tableView.mj_footer.hidden = YES;
        tableView.mj_header.hidden = YES;
        tableView.rowHeight = kHeightProportion_In_iPhoneTriploid(100);
        [superView addSubview:tableView];
    }
    return self;
}

#pragma mark -- UITableViewDelegate,UITableViewDataSource
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 5;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NeedPurTableViewCell * cell = [NeedPurTableViewCell cellWithTableView:tableView];
    cell.rowIndex = indexPath;
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (self.delegate  && [self.delegate respondsToSelector:@selector(indexPushIndex:)]) {
        [self.delegate indexPushIndex:indexPath];
    }
}
@end
